home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML Construction Kit / Dynamic HTML Construction Kit.iso / source_code / dhtmlunl / dhtml.exe / CD Content / Chap16 / dun16_3.txt < prev    next >
Encoding:
Text File  |  1997-12-18  |  1.1 KB  |  46 lines

  1. <HTML onClick="displayEventSource(this);">
  2. <HEAD>
  3.   <TITLE>The Event Path</TITLE>
  4.  
  5.   <SCRIPT>
  6.     function displayEventSource(element)
  7.     {
  8.       if (element == event.srcElement)
  9.         eventPath = "";
  10.  
  11.       eventPath += element.tagName + " ---> ";
  12.       document.all.results.innerHTML = eventPath;
  13.     }
  14.  
  15.   </SCRIPT>
  16. </HEAD>
  17.  
  18. <BODY onClick="displayEventSource(this);">
  19.   <H2>The Event Path</H2>
  20.  
  21.   <BLOCKQUOTE onClick="displayEventSource(this);">
  22.     <P>
  23.       Events bubble up the document hierarchy from a page element
  24.       to its parent element.  By clicking on a page element, a
  25.       click event is generated that travels up the document
  26.       hierarchy triggering any <TT>onClick</TT> event handlers
  27.       bound to a page element.
  28.     </P>
  29.  
  30.     <P onClick="displayEventSource(this);">
  31.       <B onClick="displayEventSource(this);">
  32.        Click here
  33.       </B>
  34.       to see the path an event takes from the <TT>B</TT> element
  35.       up the document hierarchy.
  36.     </P>
  37.  
  38.     <P><B>Event Path:</B><BR>
  39.       <PRE ID=results>
  40.       </PRE>
  41.     </P>
  42.   </BLOCKQUOTE>
  43.  
  44. </BODY>
  45. </HTML>
  46.